package com.glory.wxmemsicpda.fragment

import android.content.Intent
import android.os.Bundle
import android.view.View
import androidx.recyclerview.widget.GridLayoutManager
import com.glory.wxmemsicpda.R
import com.glory.wxmemsicpda.activity.LoginActivity
import com.glory.wxmemsicpda.base.App
import com.glory.wxmemsicpda.base.Constant
import com.glory.wxmemsicpda.utils.MyUtils
import com.pda.platform.ui.ui_pdaplatform.base.FreeUI_BaseFragment
import com.pda.platform.ui.ui_pdaplatform.callback.FreeUI_CommonCallback
import com.pda.platform.ui.ui_pdaplatform.dialog.FreeUI_GeneralFragmentDialog
import com.pda.platform.ui.ui_pdaplatform.entity.FreeUI_AddViewEntity
import com.pda.platform.ui.ui_pdaplatform.utils_public.FreeApi_ActivityManager
import com.pda.platform.ui.ui_pdaplatform.utils_public.FreeApi_DialogUtils
import kotlinx.android.synthetic.main.fragment_search.*

class SearchFragment : FreeUI_BaseFragment<Any?>(), View.OnClickListener {

    override fun getLayoutResId(): Int {
        return R.layout.fragment_search
    }

    override fun getBaseEntity(): FreeUI_AddViewEntity? {
        return null
    }
    override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
        super.onViewCreated(view, savedInstanceState)
        rvSearch.layoutManager = GridLayoutManager(activity, 3)
        initSearchArea()
        ivLogout.setOnClickListener(this)
    }
    override fun initView() {

    }


     override fun initData() {

    }


    private fun initSearchArea() {
        tvTitle.setText(
            """
    查询
    ${Constant.CURRENT_USER}
    """.trimIndent()
        )
    }

    override fun onClick(p0: View?) {
        if (MyUtils.isFastClick) {
            showToast("您点击的太快了", false)
            return
        }
        val tipDialog: FreeUI_GeneralFragmentDialog = FreeApi_DialogUtils.getConfirmAndCancelDialog(
            App.app,
            "确定要注销吗？",
            {
                startActivity(Intent(activity, LoginActivity::class.java))
                FreeApi_ActivityManager.getActivityManager().AppExit(activity)
            },
            {})
        tipDialog.show(fragmentManager!!, "DIALOG")
    }
}